package com.kfm.pm;

public class Test {

    public static void main(String[] args) {
        String a = "a";
        String b = "b";

        String c = "ab";
        String s = "ab";
        String d = "a" + "b"; // 编译时会简化成 "ab"
        String e = a + "b"; //  a + "b"
        String f = "a" + b; // "a" + b
        String g = a + b;   //
        String h = new String("ab");

        System.out.println(c == d); // true
        System.out.println(c == e); // false
        System.out.println(c == f); // false
        System.out.println(c == g); // false
        System.out.println(c == h); // false


        System.out.println("-------------------");
        System.out.println(d == e); // false
        System.out.println(e == f); // fasle
        System.out.println(e == g); // fasle
        System.out.println(f == g); // false
         String j = h.intern();
         System.out.println(j == c); // true
    }
}
